/*
 * Copyright (C) 2017-2021
 * All rights reserved, Designed By
 * Copyright authorization contact 18814114118
 */
package com.shop.cereshop.agent.redis.api;

import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.agent.page.shop.TokenInfoBo;

public interface UserRedisService {

  /** 保存用户id到redis中 */
  void saveUser(String token, String refreshToken, Long buyerUserId);

  /** 根据token获取用户id */
  Long getAgentUserIdByToken(String token);

  /** 根据refreshToken获取用户id */
  Long getAgentUserIdByRefreshToken(String refreshToken);

  /**
   * 刷新token
   *
   * @param token
   */
  TokenInfoBo refreshToken(String token) throws CoBusinessException;

  /**
   * 生成token并且保存到缓存
   *
   * @param username /
   * @param userId   /
   * @return token
   */
  TokenInfoBo createToken(String username, Long userId);

}
